package inheritance;
//子类和父类变量同名
public class Devived extends Base{
    int a ;  //与父类成员a同名，类型相同
    char b; //与父类成员b同名，类型不同
    public void method(){
        a = 10; //此时当父类和子类都拥有同名的变量时优先访问子类自己
        b = 20; //访问子类自己的
        c = 30; //访问父类继承下来的c
        //d = 100; //编译失败，子类和父类都没有d
    }

    public static void main(String[] args) {
        Devived devived = new Devived();
        devived.method();
        System.out.println(devived.b);
    }
}
